<template>
  <el-card>
      <p style="font-size: xx-large">员工工作情况</p>

    <el-table
      :data="tableData"
      style="width: 100%"
      max-height="370">
      <el-table-column
        fixed
        prop="loginDate"
        label="日期"
        width="auto">
      </el-table-column>

      <el-table-column
        fixed
        prop="sId"
        label="员工id"
        width="auto">
      </el-table-column>

      <el-table-column
        fixed
        prop="loginIp"
        label="登录ip"
        width="auto">
      </el-table-column>

      <el-table-column
        fixed
        prop="workTime"
        label="工作总时长(s)"
        width="auto">
      </el-table-column>
    </el-table>
  </el-card>
</template>

<script>
  import Global from '../../utils/global'
  export default {
    name: 'StaffWOrk',

    data(){
      return {
        glo:new Global,
        tableData: [


        ],
      }
    },
    methods:{
      inserTable (line) {
        this.tableData.push(
          {
            loginDate: line.loginDate,
            loginIp:line.loginIp,
            workTime:line.workTime,
            sId:line.sId,
          }
        )
      },
      initUploadFileLogPage (res) {
        console.log(res)
        for (var line in res.data.checkOnList){
          this.inserTable(res.data.checkOnList[line])
        }
        console.log(this.tableData)
      },

      handleRes (res) {
        console.log(res);
        let feedBack = eval(res);
        if (feedBack.success == false) {//登录失败
          this.$message("员工工作情况表获取失败");
          return;
        }
        this.$message.success("员工工作情况表获取成功^^")
        this.initUploadFileLogPage(feedBack)
      },
    },
    mounted () {
      var data = {

      }
      this.glo.sendDate(this.glo.server+'admin/getAllCheckOn',data,this.handleRes,"POST")
      // for(let i = 0 ; i < 4 ; i++){
      //   this.tableData.push(
      //     {
      //       loginDate:'2021-01-1'+i,
      //       loginIp:'192.168.65.2',
      //       workTime:101,
      //       sId:10000003
      //     }
      //   )
      // }
    }
  }</script>

<style scoped>

</style>
